#include <stdio.h>

int factorsum(int number);
void Print(int num);
void PrintPN(int m, int n);

int main()
{
    int m, n;

    scanf("%d %d", &m, &n);
    if (factorsum(m) == m)
        printf("%d is a perfect number\n", m);
    if (factorsum(n) == n)
        printf("%d is a perfect number\n", n);
    PrintPN(m, n);

    return 0;
}

int factorsum(int number)
{
    //返回number因子和
    int res = 1;
    for (int i = 2; i < number; ++i)
    {
        if (number % i == 0)
        {
            res += i;
        }
    }
    return res;
}

void Print(int num)
{
    printf("%d = 1", num);
    for (int i = 2; i < num; ++i)
    {
        if (num % i == 0)
        {
            printf(" + %d",i);
        }
    }
    printf("\n");
}

void PrintPN(int m, int n)
{
    int exist_factor = 0;
    for (int i = m; i <= n; ++i)
    {
        if(factorsum(i)==i){
            exist_factor = 1;
            Print(i);
        }
    }
    if(!exist_factor){
        printf("No perfect number");
    }
}

//被扣分：最大范围未通过，我搜了下网上的，我搜的他们在这个点也没有过